package com.ruoyi.system.enumeration;


import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 自助预订-订单日志枚举
 */
@Getter
@AllArgsConstructor
public enum SySelfServiceBookingOrderLogEnum {
    /**
     * 订单转台
     */
    TRANSFER(1, "订单转台"),
    /**
     * 删除订单
     */
    DELETE(2, "删除订单"),
    /**
     * 订单转赠
     */
    GIVE(3, "订单转赠"),
    /**
     * 取消订单
     */
    CANCEL(4, "取消订单"),
    /**
     * 修改预订时间
     */
    MODIFY_TIME(5, "修改预订时间");

    private final Integer code;

    private final String desc;

    /**
     * 根据 code 获取枚举项
     */
    public static SySelfServiceBookingOrderLogEnum fromCode(Integer code) {
        for (SySelfServiceBookingOrderLogEnum type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid log type code: " + code);
    }

    /**
     * 根据 code 获取描述信息
     */
    public static String getDescriptionByCode(Integer code) {
        return fromCode(code).desc;
    }

}
